#include <stdio.h>
#include <string.h>

enum Gender
{
  MALE,
  FEMALE
};

// 1. 用 struct 定义Student结构体
struct Student
{
  int id;
  char name[20];
  enum Gender gender;
  unsigned int score;
};

// 2. 用 typedef 定义Student结构体
typedef struct
{
  int id;             // 学号
  char name[21];      // 姓名（长度不超过20，留一个位置给字符串结束符）
  enum Gender gender; // 性别
  float score;        // 成绩
} TypeStudent;

int main()
{
  struct Student student1;
  struct Student student2 = {
      1002,
      "李四",
      MALE,
      78.0};
  TypeStudent student3 = {
      .id = 1002,
      .name = "王五",
      .gender = FEMALE,
      .score = 62.5};
  student1.id = 1;
  strcpy(student1.name, "Alice");
  student1.gender = FEMALE;
  student1.score = 95;

  // 打印每个学生的信息
  printf("===== 学生信息列表 =====\n");

  // 打印学生1信息
  printf("学号: %d\n", student1.id);
  printf("姓名: %s\n", student1.name);
  printf("性别: %s\n", student1.gender == MALE ? "男" : "女");
  printf("成绩: %d\n\n", student1.score);

  // 打印学生2信息
  printf("学号: %d\n", student2.id);
  printf("姓名: %s\n", student2.name);
  printf("性别: %s\n", student2.gender == MALE ? "男" : "女");
  printf("成绩: %d\n\n", student2.score);

  // 打印学生3信息
  printf("学号: %d\n", student3.id);
  printf("姓名: %s\n", student3.name);
  printf("性别: %s\n", student3.gender == MALE ? "男" : "女");
  printf("成绩: %.2f\n", student3.score);

  return 0;
}